﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;
using System.Text.RegularExpressions;
using FortuneHeavenBAL;
using FortuneHeavenCommon.DataMap;

namespace FortuneHeaven.Admin.Controls
{
    public partial class UserToolbar : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
        public string GetTitle()
        {
            StringBuilder builder = new StringBuilder();
            string file = System.IO.Path.GetFileName(Request.PhysicalPath);
            string[,] content = { {"UserInforDetail.aspx","用户信息"}, {"UserInforDetail_Score.aspx","游戏信息"}, 
                                 {"UserInforDetail_EnterRoom.aspx","进入房间记录"},
                                 {"UserInforDetail_LeaveRoom.aspx","离开房间记录"},
                                 {"UserInforDetail_Charge.aspx","充值记录"},
                                 {"UserInforDetail_GiveScore.aspx","转送积分记录"},
                                 {"UserInforDetail_PurchaseShow.aspx","购买游戏秀记录"},
                                 {"UserInforDetail_Spread.aspx","推广记录"}};
            string start = VirtualPathUtility.ToAbsolute("~/Pages/GameManager/");
            string query = GetNewStr();
            for (int index = 0; index < content.GetLength(0); index++)
            {
                if (content[index, 0].ToLower() == file.ToLower())
                {
                    builder.Append(string.Format("<span class='showurl'>{0}</span>", content[index, 1]));
                }
                else
                {
                    builder.Append(string.Format("<a class='showurl' style='text-decoration: underline;' href = '{0}'>{1}</a>",
                        start + content[index, 0] + query, content[index, 1]));
                }
            }
            return builder.ToString();
        }

        public string GetNewStr()
        {
            if (string.IsNullOrEmpty(Request["ID"]))
            {
                if (!string.IsNullOrEmpty(Request["Accounts"]))
                {
                    AccountsInfoBO bo = new AccountsInfoBO();
                    AccountsInfo infor = bo.GetLightAcountInfor(Request["Accounts"]);
                    if (infor != null)
                    {
                        return Request.Url.Query + "&ID=" + infor.UserID;
                    }
                }
            }
            return Request.Url.Query;
        }
    }
}